package com.mywork.mvpkodeinxml.room.dao

import androidx.room.*
import com.mywork.mvpkodeinxml.room.entity.FileCacheEntity

@Dao
interface FileCacheDao {
    @get:Query("SELECT * FROM FileCache order by fileId asc")//desc
    val allFiles: List<FileCacheEntity>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(vararg files: FileCacheEntity)

    @Update
    fun update(vararg users: FileCacheEntity)

    @Delete
    fun delete(vararg users: FileCacheEntity)

    @Query("DELETE FROM FileCache")
    fun deleteAllUsers()

    @Query("SELECT * FROM FileCache WHERE userCode=:userCode AND fileId=:fileId ")
    fun getFileById(userCode: String, fileId: String): List<FileCacheEntity>

}
